package lintulaskenta.utils;

import java.io.Serializable;


public class Item implements Comparable<Item>, Serializable {

    private String mKey;
    private String mValue;

    public Item(String k, String v) {
        mKey = k;
        mValue = v;
    }

    public String getKey() {
        return mKey;
    }

    public String getValue() {
        return mValue;
    }

    @Override
    public String toString() {
        return "(" + mKey + ", " + mValue + ")";
    }

    public int compareTo(Item o) {
        String arvo = (String) mValue;
        String vertaa = (String) o.getValue();
        if (arvo.trim().length() == 0) {
            return 1;
        }
        if (vertaa.trim().length() == 0) {
            return -1;
        }
        return arvo.compareToIgnoreCase(vertaa);
    }

}
